<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>遇见最美的你-搭配</title>
    <link rel="stylesheet" href="__PUBLIC__/css/weui/weui.min.css">
    <link rel="stylesheet" href="__PUBLIC__/seller/css/weui.css">
    <link rel="stylesheet" href="__PUBLIC__/seller/css/weui2.css?id=333">

    <style>
    .container{
        width: 100%;
        height: 100%;
        overflow-x: scroll;
        -webkit-overflow-scrolling : touch;
        margin-bottom: 50px;
    }
    html, body, .page-wrap {
        width: 100%;
        height: 100%;
    }

    .page {
        width: 100%;
        height: 100%;
        -webkit-backface-visibility: hidden;
        -webkit-perspective: 1000;
    }
    .arrow{
        position: absolute;
        left: 50%;
        bottom: 10px;
        width: 33px;
        height: 18px;
        margin-left: -16px;
        background: url() no-repeat;
        background-size: 33px auto;
        opacity: 0;
    }

   .arrow{
    position: absolute;
    left: 50%;
    bottom: 10px;
    width: 33px;
    height: 18px;
    margin-left: -16px;
    background: url() no-repeat;
    background-size: 33px auto;
    opacity: 1;
}

/*上滑提示*/
@-webkit-keyframes swipeMoveTop {
    0% {
        opacity: 0;
        -webkit-transform: translate3d(0, 10px, 0);
    }
    70% {
        opacity: 1;
        -webkit-transform: translate3d(0, 0, 0);
    }
    100% {
        opacity: 0;
        -webkit-transform: translate3d(0, -10px, 0);
    }
}

/*左滑提示*/
@-webkit-keyframes swipeMoveLeft {
    0% {
        opacity: 0;
        -webkit-transform: translate3d(10px, 0, 0);
    }
    70% {
        opacity: 1;
        -webkit-transform: translate3d(0, 0, 0);
    }
    100% {
        opacity: 0;
        -webkit-transform: translate3d(-10px, 0, 0);
    }
}

@-webkit-keyframes slideToTop {
    0% {
        opacity: 0;
        -webkit-transform: translate3d(0, 100px, 0);
    }
    100% {
        opacity: 1;
        -webkit-transform: translate3d(0, 0, 0);
    }
}
@-webkit-keyframes slideToLeft {
    0% {
        opacity: 0;
        -webkit-transform: translate3d(100px, 0, 0);
    }
    100% {
        opacity: 1;
        -webkit-transform: translate3d(0, 0, 0);
    }
}
  
    
    .goback{
    	position: fixed;
    	top:5px;
    	left:10px;
        z-index: 10000;
    }
    .mote{
    	width:100%;
        position: relative;
    }
    .mote_box{
    	width:200px;
    	float:left;
    }
    .dresse_box{
    	width:40%;
    	float:right;
    	margin-right:20px;
        margin-top:30px;
    }
     @media only screen and (max-width:320px){
         .dresse_box{
            width:30%;
         }
    }
    .btn{
    	font-weight: normal;
    	font-size:14px;
    	background: rgba(0,0,0,0.1);
    	margin-top:20px;
    	border-radius: 5px;
    	text-align: center;
    	line-height: 36px;
    	vertical-align: middle;
    	cursor: pointer;
    }

    .dresse_box h4{
    	font-weight: normal;
    	font-size:14px;
    	background: rgba(0,0,0,0.1);
    	margin-bottom:10px;
    	text-align: center;
    	line-height: 36px;
    	vertical-align: middle;
        color:#d81e06;
    }
     @media only screen and (max-width:320px){
         .dresse_box h4{
            font-size:12px;
         }
    }
    .dresse_box h4 img{
    	vertical-align: middle;
    	line-height: 36px;
    }
    .dresse_box .box{
    	background: rgba(0,0,0,0.1);
    	height: 400px;
    	overflow-y: scroll!important; 
      text-align: center;
      font-size:12px;

    }
    .dresse_box .box img{
    	margin-left:10px;
    }
    .dresse_box .box .item-li{
        margin-top:10px;
    }
    h3{
    	font-weight:normal;
    	font-size:18px;
    	margin: 0 auto;
    	text-align: center;

    }
    .weui_btn{
        font-size:12px;
        padding:0px 9px;
    }
  
    </style>
   
</head>
<body ontouchstart="">
    <div class="container">
    <div class="page-wrap" style="transition: -webkit-transform 0.5s ease 0s; transform: translate(0px, 0%);">
        <volist name="urls" id="vv" key="k">
        <div class="page" id="page{$k}">
            <div class="mote">
                <div class="mote_box"><img src="{$vv}" width="100%"></div>
                <div class="dresse_box"><h4><img src="__PUBLIC__/seller/img/vote/shopcart.png">第七感觉热卖</h4>
                    <div class="box" id="wrapper">
                    <ul>
                        <volist name="product" id="vo" >
                         <li data="{$i}"><a class="item-li" href="/index.php/Mobile/Interact/vote_view/voteid/25/moban/1.html">
                            <img src="{$vo}" width="100">
                         </a></li>
                        </volist>
                    </ul>
                    </div>
                </div>
                <div style="clear:both"></div>
            </div>
        </div>
        </volist>
    </div>
    </div>


<input type="hidden" name="voteid" value="{$voteid}" id="voteid"/>
<include file="Interact/foot_nav3" />
<script src="__PUBLIC__/seller/js/weui_zepto.min.js"></script>
<script src="__PUBLIC__/seller/js/weui_fullpage.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<!-- <script src="__PUBLIC__/js/vconsole.min.js"></script> -->
<script src="__PUBLIC__/js/zepto.cookie.min.js"></script>

<script>
       var PageSlider =  new PageSlider({
            pages: $('.page-wrap .page'),
            animationPlayOnce: false,//翻页动画只执行一次
            direction: 'h',//水平h  垂直v 修改类 arrow-h
            gestureFollowing: 'true',  //可选，如果为 true，则开启手势跟随模式
        });
       $('.page').each(function(){
         var idname=$(this).attr('id');
         scroll(idname);
       })
function scroll(idname){
    var scrtime;
    var $ul = $('#'+idname).find('ul');
    var liHeight = $ul.find("li:last-child").height();
    scrtime = setInterval(function(){
        var last=$ul.find("li:last-child");
        var first=$ul.find("li:first-child");
        $ul.animate({marginTop : liHeight + "px"},500,function(){
        last.prependTo($ul);
        first.hide();
        $ul.css({marginTop:0});
        first.fadeIn(600);
        });
    },3000);
}
   

/*微信接口调用*/
wx.config({
    debug: false,
    appId: '{$signPackage["appId"]}',
    timestamp: '{$signPackage["timestamp"]}',
    nonceStr: '{$signPackage["nonceStr"]}',
    signature: '{$signPackage["signature"]}',
    jsApiList: [
      'chooseImage', 'uploadImage', 'downloadImage','hideMenuItems','onMenuShareAppMessage','onMenuShareTimeline'
    ]
  });

wx.ready(function(){

  wx.onMenuShareTimeline({
      title: '{$vote.fvote_title}', // 分享标题
      link: window.location.host+window.location.pathname+'?dltoken={$signPackage["appId"]}&from=Timeline&sub_fvipkey={$sub_fvipkey}&vitemid={$vitemid}', // 分享链接
      imgUrl: 'http://'+window.location.host+'{$vote.fvote_wappicurl}', // 分享图标
      success: function () { 
          // 用户确认分享后执行的回调函数
          addvote_allowint('ShareTimeline');
          share_tj('Timeline');
      },
      cancel: function () { 
          // 用户取消分享后执行的回调函数
          
      }
  });

  wx.onMenuShareAppMessage({
      title: '{$vote.fvote_title}', // 分享标题
      desc: '{$vote.fvote_fxms}', // 分享描述
      link:  window.location.host+window.location.pathname+'?dltoken={$signPackage["appId"]}&from=AppMessage&sub_fvipkey={$sub_fvipkey}&vitemid={$vitemid}', // 分享链接
      imgUrl: 'http://'+window.location.host+'{$vote.fvote_wappicurl}', // 分享图标
      type: '', // 分享类型,music、video或link，不填默认为link
      dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
      success: function(){ 
          // 用户确认分享后执行的回调函数
          addvote_allowint('ShareAppMessage');
          share_tj('AppMessage');
      },
      cancel: function () { 
          // 用户取消分享后执行的回调函数
      }
  });
})

//分享增加投票资格
function addvote_allowint(type){
  var voteid=$('#voteid').val();
    $.post('{:U("Ajax/addvote_allowint")}',{voteid:voteid,type:type},function(res){
        setTimeout(function(){
          $.toast(res.msg);
        },1000)
    })
}
function share_tj(share_area){
      var voteid=$('#voteid').val();
       $.post('{:U("Ajax/tongji_share")}',{
        voteid:voteid,
        share_area:share_area,
        dltoken:'{$signPackage["appId"]}'
       },function(res){

       })
  }
function ChangeParam(name,value)
 {
  var url=window.location.host+window.location.pathname;
  var newUrl="";
var reg = new RegExp("(^|)"+ name +"=([^&]*)(|$)");
var tmp = name + "=" + value;
if(url.match(reg) != null)
{
 newUrl= url.replace(eval(reg),tmp);
}
else
{
 if(url.match("[\?]"))
 {
 newUrl= url + "&" + tmp;
 }
 else
 {
 newUrl= url + "?" + tmp;
 }
}
   return newUrl;
 }

 
 /*-- 统计功能 --*/
 $(function(){
   var voteid=$('#voteid').val();
   var sub_fvipkey=getUrlParam('sub_fvipkey');
   var scan_type=getUrlParam('from');
   var dltoken=getUrlParam('dltoken');
   var fromuri=window.location.host+window.location.pathname;
   $.post('{:U("Ajax/tongji_vote")}',{
    voteid:voteid,
    sub_fvipkey:sub_fvipkey,
    scan_type:scan_type,
    dltoken:dltoken,
    fromuri:fromuri
  },function(res){

   })

   
 })
//获取url中的参数
  function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }  
do_vote();
/*投票函数*/
function do_vote(){
  $('.do_vote').click(function(){
    var fkey=$(this).attr('data');
    post_vote(fkey);
  })
}
function post_vote(fkey,action){
  var voteid=$('#voteid').val();
  $.post('{:U("Ajax/do_vote")}',{fkey:fkey,voteid:voteid,moban:'{$moban}',action:action},function(res){
      if(res.error=="success"){
          $.toast(res.msg);
      }
     
      if(res.error=="no_subsribe"){
        if($.fn.cookie('alert')=='no_subsribe'){
            post_vote(fkey,'do');
        }else{
            $.confirm(res.msg, "温馨提示", function() {
                 gosubscribe();
            }, function() {
              post_vote(fkey,'do');
              //取消操作
            }); 
            $.fn.cookie('alert','no_subsribe',{ expires: 1});
        } 
      }
      if(res.error=="zg_over"){
        $.toast(res.msg,res.statu);
      }
      if(res.error=="no_reg"){
        if($.fn.cookie('alert')!='no_reg'){
          post_vote(fkey,'do');
        }else{
          $.confirm(res.msg, "温馨提示", function() {
               location.href='{:U("Home/Register/index")}';
          }, function() {
            post_vote(fkey,'do');
            //取消操作
          }); 
          $.fn.cookie('alert','no_reg',{expires: 1});
        } 
      }
  })
}
</script>

</body>
</html>